ROI analysis
Before taking on the analysis of regions of interest we recommend to take a look at the tutorials for watershed
and threshold
, notably their options and the blurring techniques to optimize the output.
ROI (Regions of Interest) analysis refers to the process of identifying and analyzing specific regions within an image that are of interest. It is probably a topic too vast to fit it completely in one tutorial. But we will try to give you the basic idea of what image analysis might look like. First, let's take an image of particles made by electronic microscope as our example.
Getting Regions of Interest
To get ROIs, first you need to find ROI map. There are two general ways of doing it. First one is threshold
method which works well for images where elements are placed separately from each other:
const mask = image.threshold();
const roiMap = fromMask(mask);
Second option is watershed
function. If an image has many adjacent elements, using watershed
might be a better option:
const roiMap = watershed(image, { points, mask });
You can see a good image to use threshold on the left and an image for watershed on the right.
First we need to extract regions of interest from a map for further analysis:
//in this case we are interested in dark regions of interest, so we
//specify the kind of ROIs we want to extract.
let rois = roiMap.getRois({ kind: 'black' });
//Removes regions that did not fit in the image.
//It gives you a better data sample.
rois = clearBorder(mask, { color: 'black' });
Notice how the elements at the borders are not included. The reason is that these regions simply did not fit completely into our image ,so, their features, such as size or shape will not be represented correctly. So, we used clearBorder
function to remove those elements. It is a good practice for regions' analysis.